﻿using Mbs.Reflection;

namespace Mbs.Elements
{
    class SimpleElement:Element<object>
    {
        protected override object DoAdd(object uiElement)
        {
            return uiElement;
        }

        protected override void DoRemove(object uiElement)
        {
        }

        public override string Name
        {
            get
            {
                return Target.GetProperty<string>("Id");
            }
            set
            {
                Target.SetProperty("Id", value);
            }
        }

        public override string Text
        {
            get
            {
                return Target.GetProperty<string>("Text");
            }
            set
            {
                Target.SetProperty("Text", value);
            }
        }

        public override object Tag
        {
            get
            {
                return Target.GetProperty("Tag");
            }
            set
            {
                Target.SetProperty("Tag", value);
            }
        }

        public override bool? Enabled
        {
            get
            {
                return Target.GetProperty<bool>("Enabled");
            }
            set
            {
                Target.SetProperty("Enabled", value.HasValue ? value.Value : false);
            }
        }

        public override bool? Visible
        {
            get
            {
                return Target.GetProperty<bool>("Visible");
            }
            set
            {
                Target.SetProperty("Visible", value.HasValue ? value.Value : false);
            }
        }
    }
}
